home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14836 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.3 KB

  1. Path: zrz.TU-Berlin.DE!marie!wpp
  2. From: wpp@marie.physik.TU-Berlin.DE (Kai Petzke)
  3. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Date: 1 Apr 96 14:54:37 GMT
  6. Organization: Technical University Berlin, Germany
  7. Message-ID: <wpp.828370477@marie.physik.TU-Berlin.DE>
  8. References: <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu> <4j03p4$fbt@hoho.quake.net> <Doq3sv.MzA@research.att.com> <4jcf89$2k9@crc-news.doc.ca> <4jdv0p$lnr@dscomsa.desy.de>
  9. NNTP-Posting-Host: marie.physik.tu-berlin.de
  10.  
  11. mernst@x4u2.desy.de (Matthias Ernst) writes:
  12.  
  13. >The idea of resumption or retry is that after an inner frame throws an
  14. >exception the outer handler may alter the state or supply more information
  15. >and then _REENTER_ the inner frame either at the point where the exception
  16. >was thrown (resumption) or at the beginning of the try block (retry).
  17.  
  18. I ask myself, why there should be only these two possibilities -
  19. resumption at the throw point versus restart of the complete try
  20. block.  Together with the "abort" method, that leaves a total of
  21. 3 alternatives, that an error handler may choose from.  Well,
  22. that was up-to-date back at the days, that people invented MS-DOS.
  23. Most of you probably have seen that pop-up window, that says something
  24. like: "read error on drive A:", and then lets you choose from
  25. "Retry", "Ignore" (which is a very crude implementation of the "resume"
  26. case from above) or "Abort".
  27.  
  28.  
  29. Intelligent applications may want to provide more alternatives.  A
  30. typical one is: "Recover from backup media".  In video and audia data
  31. processing, the following might be usefull: "Replace faulty disk block
  32. with interpolation of the data from neighboring blocks".  (High-end
  33. compact disk players do this automatically, btw.).  Or: "Cut out
  34. the frames, that cannot be read".  
  35.  
  36.  
  37. In such a more user friendly scheme of error recovery, resumption
  38. has to be performed at different levels of the data reading routine,
  39. depending on the users choice at run time.  In some cases, a complete
  40. new file has to be opened and read.  In other cases, reading is continued
  41. at a later position in the file, requiring to modify some loop indexes
  42. in the reading code, as well, as to re-position the file.
  43.  
  44.  
  45. I don't know, though, if the above is a real-world example.  Most
  46. people don't seem to program that way.  But it is an example, of
  47. what *I* like to be able to do.  It requires:
  48.  
  49. * The exception handler must have both access to the context of the
  50.   caller as well to that of the callee.  In particular, the callee's
  51.   data must still exist, when the exception handler is reached.
  52. * The exception handler must be able to decide, where to resume the
  53.   execution of the callee, whether at the throw point, at some
  54.   designated breakpoint, or not at all.
  55.  
  56. I don't see, how C++'s throw/catch/try scheme is able to handle this
  57. general case.  This is one of the reasons, why I dislike C++, and prefer
  58. BETA.  But this is a question of taste, not a question of reason.
  59.  
  60.  
  61.  
  62.  
  63. Kai
  64. --
  65. Kai Petzke, Technical University of Berlin, Germany
  66. http://www.physik.tu-berlin.de/~wpp/ to learn about Linux, Postgres and BETA.
  67. wpp@marie.physik.tu-berlin.de for regular e-mail
  68. How fast can computers get?  --  Warp 9, of course, on Star Trek.
  69.